package cn.tsmchina.one.service.rproduct;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.tsmchina.one.dao.product.ProductDao;
import cn.tsmchina.one.dao.rproduct.RproductDao;
import cn.tsmchina.one.domain.product.Product;
import cn.tsmchina.one.domain.rproduct.Rproduct;

@Service
public class RproductServiceImpl implements RproductService
{
	@Autowired
	private RproductDao productDao;
	
	
	@Override
	public Long addProduct(Rproduct product)
	{
		
		return productDao.addProduct(product);
	}

	@Override
	public void deleteProductById(Long id)
	{
		productDao.deleteById(id);
	}
	
	@Override
	public void updateProduct(Rproduct product)
	{
		productDao.updateProduct(product);
	}

	@Override
	public List<Rproduct> getQueryOrder(int page, long customerId)
	{
		return productDao.getQueryOrder(page, customerId);
	}

	@Override
	public int getTotal(long customerId)
	{
		return productDao.total(customerId);
	}

	@Override
	public Rproduct getProduct(long id)
	{
		return productDao.getProduct(id);
	}


	@Override
	public List<Rproduct> getProducts(long customerId)
	{
		
		return productDao.getProducts(customerId);
	}

	@Override
	public List<Rproduct> getFoodsByCategory(int cid, int page) {
		return productDao.getFoodsByCategory(cid, page);
	}

	@Override
	public List<Rproduct> getFoodsByCategoryName(String name, int page) {
		return productDao.getFoodsByCategoryName(name, page);
	}
	
	@Override
	public int getFoodsCountByCategory(int cid) {
		return productDao.getFoodsCountByCategory(cid);
	}
	
	@Override
	public int getFoodsCountByCategoryName(String name) {
		return productDao.getFoodsCountByCategoryName(name);
	}
		

}
